const HtmlWebpackPlugin = require('html-webpack-plugin');
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const path = require('path')
module.exports = {
  mode: 'development',
  devtool: false,
  entry: './src/index.js',
  devServer: {
    port: 3800
  },
  optimization: {
    chunkIds: 'deterministic',
    moduleIds: 'deterministic'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-react']
            }
          }
        ],
        exclude: /node_modules/
      },

    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './public/index.html'
    }),
    new ModuleFederationPlugin({
      filename: 'remoteEntry.js', // 构建输出的文件名
      name: 'remote', // 必传值,输出的模块名
      exposes: {// 被远程使用时可暴露的资源路径及别名
        './NewsList': './src/NewsList' // key(别名):value(路径)
      }


    })
  ]

}